#include <cstdio>

struct Edge
{
    int a, b;
};

Edge edge[ 11 ];
int n;
bool visit[ 11 ];
bool dfs( int p, int step )
{
    int i;
    bool ac = false;
    if ( step < n )
    {
        for ( i = 0; i < n; i++ )
            if ( !visit[ i ] )
            {
                if ( edge[ i ].a == p )
                {
                    visit[ i ] = true;
                    ac |= dfs( edge[ i ].b, step + 1 );
                    visit[ i ] = false;
                }
                if ( edge[ i ].b == p )
                {
                    visit[ i ] = true;
                    ac |= dfs( edge[ i ].a, step + 1 );
                    visit[ i ] = false;
                }
            }
        return ac;
    }
    if ( step == n )
        return p == edge[ 0 ].a;
}

int main( )
{
    int i, a, b, cas = 1, c;
    while ( scanf("%d", &n) && n )
    {
        for ( i = 0; i < n; i++ )
        {
            visit[ i ] = false;
            scanf("%d%d", &edge[ i ].a, &edge[ i ].b);
        }
        visit[ 0 ] = true;
        printf("Set #%d: ", cas++);
        if ( !dfs( edge[ 0 ].b, 1 ) )
            puts("NO");
        else
            puts("YES");
    }
    return 0;
}
